package com.grwx.omc.kafka.basekafka.controller;

import com.grwx.omc.kafka.basekafka.producer.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: kafka的服务层方法
 * @Author: ManJiang
 * @Date: 2020/5/8
 */
@RestController
public class KafkaController {

    @Autowired
    KafkaProducer kafkaProducer;

    /**
     * 基础服务发送消息，指定topic
     * @param msg
     * @param topic
     */
    @RequestMapping("/message/send")
    public void sendString(String msg,String topic){
        kafkaProducer.sendMsg(msg,topic);
    }
}
